package cn.dogger.easyboot.log.aspect;

import cn.dogger.easyboot.log.utils.Log;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;


/**
 * @author DOGGER-001
 */
@Aspect
@Component
public class Slf4jAspect {

    @Pointcut("@annotation(cn.dogger.easyboot.log.annotation.Slf4j)|| @within(cn.dogger.easyboot.log.annotation.Slf4j)")
    public void slf4jPointCut() {}

    /**
     * 切面
     * @param point  Cut point
     * @return Object
     * @throws Throwable Throwable
     */
    @Around("slf4jPointCut()")
    public Object around(ProceedingJoinPoint point) throws Throwable {
        new Log(point.getTarget().getClass());
        return point.proceed();
    }
}
